package com.google.code.jtasks.server.dao.TokenManagers;

import com.google.common.collect.Maps;
import com.google.inject.Inject;
import com.google.inject.Provides;

import javax.inject.Singleton;
import java.util.Map;

/**
 * Class to generate a token for each user
 */
public class DefaultTokenManager implements TokenManager {


    /**
     * Collection pairs a user token
     */

    private Map<Integer, String> tokenUser = Maps.newHashMap();

    @Inject
    public DefaultTokenManager() {
    }


    /**
     * Method to generate a token for each user
     * @param userName
     */


    @Singleton @Provides
    public void setUserName(String userName) {
        int countUser = 10000;
        int tokenValue = (int) Math.random();
        tokenUser.put(tokenValue, userName);
      }

    /**
     *
     * @return HashMap token and user
     */
    public Map<Integer,String > getMap(){
        return tokenUser;
    }
}
